package com.huawei.appgallery.search.ui.card;

import android.content.Context;
import android.view.View;
import android.widget.ImageView;
import android.widget.RelativeLayout.LayoutParams;
import android.widget.TextView;
import com.huawei.appgallery.foundation.ui.framework.cardkit.bean.CardBean;
import com.huawei.appgallery.foundation.ui.framework.widget.button.DownloadButton;
import huawei.widget.HwTextView;
import o.azb;
import o.cgz;
import o.cuv.a;
import o.cuv.b;
import o.cvj;
import o.epv;
import o.eqx;

public class SearchSpecialTopicItemSubCard extends BaseCompositeItemCard {
    private View ʻ;
    private ImageView ʽ;
    private HwTextView ˋ;
    private View ॱॱ;
    private TextView ᐝ;

    public SearchSpecialTopicItemSubCard(Context context) {
        super(context);
    }

    public cgz ˏ(View view) {
        ˏ((ImageView) view.findViewById(b.ˊˋ));
        ॱ((TextView) (HwTextView) view.findViewById(b.ॱʽ));
        ˊ((TextView) (HwTextView) view.findViewById(b.ˌ));
        ˋ((DownloadButton) view.findViewById(b.ॱˋ));
        this.ᐝ = (TextView) view.findViewById(b.ꜟ);
        this.ˋ = (HwTextView) view.findViewById(b.ॱʼ);
        this.ʽ = (ImageView) view.findViewById(b.ˏˏ);
        this.ॱॱ = view.findViewById(b.ʽ);
        ˏ(view.getContext(), this.ʽ);
        azb.ˏ(view, b.ᐝˊ);
        ʽ(view);
        return this;
    }

    public void w_() {
        eqx.ˏ(ʼॱ(), this.ˊᐝ.ॱˌ(), "app_default_icon");
    }

    public void ˏ(CardBean cardBean) {
        super.ˏ(cardBean);
        if (cardBean instanceof cvj) {
            cvj o_cvj = (cvj) cardBean;
            ˏ(ˊˋ(), o_cvj.v_());
            ˏ(this.ˋ, o_cvj.ˎͺ());
            String ˏˏ = o_cvj.ˏˏ();
            ˋ(this.ᐝ, o_cvj.ˋʻ());
            ˏ(ˋˊ(), ˏˏ);
            if (ˊ(o_cvj.ꜟ())) {
                this.ʽ.setVisibility(8);
                if (o_cvj.ॱㆍ()) {
                    this.ॱॱ.setVisibility(8);
                    return;
                } else {
                    this.ॱॱ.setVisibility(0);
                    return;
                }
            }
            this.ʽ.setVisibility(0);
            this.ॱॱ.setVisibility(8);
        }
    }

    protected boolean ˊ(boolean z) {
        return z;
    }

    private void ˏ(Context context, ImageView imageView) {
        if (imageView != null) {
            LayoutParams layoutParams = (LayoutParams) imageView.getLayoutParams();
            layoutParams.setMarginStart(context.getResources().getDimensionPixelSize(a.ʼ) + (azb.ˊ(context) + epv.ˊ()));
            layoutParams.setMarginEnd(azb.ˏ(context));
        }
    }

    public View ˋ() {
        return this.ʻ;
    }

    public void ˎ(View view) {
        this.ʻ = view;
    }
}
